package org.graduates.webapp.actions;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

public class LogoutAction extends BaseAction {

	private static final long serialVersionUID = -3706856384474152895L;
	@Action(results={@Result(name="success", type="redirect", location="main.action"),@Result(name="input", type="redirect", location="main.action")})
	public String execute() {
		Subject subject =  SecurityUtils.getSubject();
		if(null == subject)
			return INPUT;
		
		subject.logout();
		
		return SUCCESS;
	}

}
